#include "algo_math.h"


// 快速开平方根求倒
f32 inv_sqrt(f32 x)
{
    f32 xhalf = 0.5f * x;
    int32 i = *(int32*)&x;          	// get bits for floating value
    i =  0x5f375a86 - (i>>1);   	// gives initial guess
    x = *(f32*)&i;            	// convert bits back to f32
    x = x * (1.5f - xhalf*x*x); 	// Newton step
    return x;
}
